﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BUS;
using DTO;
namespace QUANLYDIEMHOCSINH
{
    public partial class Thamso : Form
    {
        THAMSOBUS tsbus = new THAMSOBUS();
        public Thamso()
        {
            InitializeComponent();
            LoadDachThamSo();
        }

        void LoadDachThamSo()
        {
            List<THAMSODTO> ds = tsbus.DanhSachThamSoDiem();
            txtYeu.Text = ds[0].GIATRI;
            txtTrungBinh.Text = ds[1].GIATRI;
            txtKha.Text = ds[2].GIATRI;
            txtGioi.Text = ds[3].GIATRI;
            txtXuatSac.Text = ds[4].GIATRI;
        }
        private void txtYeu_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (!Char.IsDigit(e.KeyChar) && !Char.IsControl(e.KeyChar))
            {
                e.Handled = true;
            }
        }

        private void txtTrungBinh_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (!Char.IsDigit(e.KeyChar) && !Char.IsControl(e.KeyChar))
            {
                e.Handled = true;
            }
        }

        private void txtKha_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (!Char.IsDigit(e.KeyChar) && !Char.IsControl(e.KeyChar))
            {
                e.Handled = true;
            }
        }

        private void txtGioi_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (!Char.IsDigit(e.KeyChar) && !Char.IsControl(e.KeyChar))
            {
                e.Handled = true;
            }
        }

        private void txtXuatSac_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (!Char.IsDigit(e.KeyChar) && !Char.IsControl(e.KeyChar))
            {
                e.Handled = true;
            }
        }

        private void btnThoat_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btnDongY_Click(object sender, EventArgs e)
        {
            for(int i=0;i<5;i++)
            {
                THAMSODTO ts =new THAMSODTO();
                ts.MATS=i+1;
                ts.GIATRI = txtYeu.Text;
                tsbus.CapNhatThamSoDiem(ts);
            }
            
        }
    }
}
